<?php

namespace Biz\model\springHomeDecActivity;

use Biz\model\advertisement\MBaseDbModel;
use Biz\pockets\modelTrait\BizModelTrait;

class MSpringHomeDecWinningRecord extends MBaseDbModel
{
    const _CONFIG_FILE_ = 'db_store';
    
    const _CONFIG_SELECT_ = 'db_brand_activity';
    
    const _DATABASE_ = 'brand_activity';
    
    const _TABLE_NAME = 'spring_home_dec_winning_record';

    #收货地址
    const RESERVE_YES = 1; //已填写
    const RESERVE_NO = 0;  //未填写


    //删除字段名称
    protected static $deleteField = 'data_status';
    
    
    use BizModelTrait;


    public static function addRecord($uid, $product_id, $product_type)
    {
        $data = [
            'uid' => $uid,
            'product_id' => $product_id,
            'product_type' => $product_type,
            'winning_date' => date("Y-m-d"),
            'create_time' => date("Y-m-d H:i:s"),
            'data_status' => self::STATUS_NORMAL,
        ];
        return self::dataInsert($data);
    }

    public static function winningCount($uid){
        $where['uid'] = $uid;
        $where['data_status'] = self::STATUS_NORMAL;
        return self::dataCount($where);
    }
}
